package com.special.threademo.concurrency.waitNotify;

/**
 * Created with IDEA2020.3
 * author:LiuYC
 * DateTime:2021/1/7  13:03
 */
public class DecreaseThread  extends Thread{
    private DeOrIncrease deOrIncrease;

    public DecreaseThread(DeOrIncrease deOrIncrease) {
        this.deOrIncrease = deOrIncrease;
    }

    @Override
    public void run() {
        for (int i = 0; i < 30; ++i) {
            try {
                Thread.sleep((long) Math.random() * 1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            deOrIncrease.decrease();
        }

    }
}
